Skip to content

docs: add ADR-0021 remote operations API - #124

Merged
delete-cloud merged 2 commits into
mainfrom
feat/adr-0021-remote-operations-api
May 10, 2026
Merged

delete-cloud merged 2 commits into
mainfrom
feat/adr-0021-remote-operations-api

Conversation

@delete-cloud

@delete-cloud delete-cloud commented May 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add ADR-0021 defining P1 as an HTTP-first Remote Session and Workspace Operations API
  • Specify session/workspace operations, async cancel semantics, archive manifest flow, and normal/admin token scope
  • Restore the missing parent-child subagent eval golden fixture so integration e2e stays green

Validation

  • uv run pytest tests/coding_agent/evaluation/test_adapter.py -q
  • uv run pytest tests/integration/test_pipeline_e2e.py::TestPipelineE2E::test_subagent_turn_persisted_tape_flows_into_eval_adapter -q
  • tmux: uv run pytest tests/integration -v -> 41 passed, 4 skipped

Summary by CodeRabbit

Release Notes

  • Documentation
    • Added architectural specification for a remote session and workspace operations API, defining endpoints for session management (listing, monitoring, cancellation), workspace operations (creation, deletion, archival with manifest downloads), authentication scopes, and CLI client enhancements.

Review Change Stack

Restore the missing parent/child eval golden fixture so integration e2e stays green, and define HTTP-first remote operations as the P1 boundary.
@coderabbitai

coderabbitai Bot commented May 10, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@delete-cloud has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 46 minutes and 17 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: acb441c2-39f2-4105-b430-e6c18143fc1e

📥 Commits

Reviewing files that changed from the base of the PR and between 9c895a3 and a691404.

📒 Files selected for processing (1)
  • coding-agent/docs/adr/0021-remote-session-and-workspace-operations-api.md
📝 Walkthrough

Walkthrough

The PR adds golden evaluation test files for parent-child subagent scenarios and introduces ADR-0021, which specifies a P1 HTTP-first Remote Session and Workspace Operations API with token-scoped authorization, manifest-first archive download safety, and CLI as a thin HTTP client for remote operations.

Changes

Parent-Child Subagent Evaluation Tests

Layer / File(s) Summary
Golden Evaluation Test Data
coding-agent/data/eval/golden/parent-child-subagent-001.jsonl, coding-agent/data/eval/golden/parent-child-subagent-001.yaml
New JSONL transcript and YAML config files define a parent-child subagent test case with parent task, subagent tool invocation, child event sequence marked with skip_context and subagent_child metadata, parent tool result, and completion response. YAML specifies the subagent tool, disallows bash_run, and sets threshold to 1.0.

Remote Session and Workspace Operations API (ADR-0021)

Layer / File(s) Summary
ADR Context & Scope
coding-agent/docs/adr/0021-remote-session-and-workspace-operations-api.md (lines 1–40)
Establishes P1 as HTTP-first API boundary for remote operations: P0 enables team deployment but lacks daily session/workspace inspection, control, safe download, and cleanup. Server API owns state and lifecycle semantics; CLI is scoped to thin client surface.
Session Operations API
coding-agent/docs/adr/0021-remote-session-and-workspace-operations-api.md (lines 41–103)
Canonical P1 session endpoints: list/get/delete/prompt/cancel/events. Requires session status and turn status separation. Mandates async cancellation with "cancelling" state and eventual "cancelled" or "failed" outcomes reported via status and SSE events.
Workspace Operations API
coding-agent/docs/adr/0021-remote-session-and-workspace-operations-api.md (lines 104–132)
Canonical P1 workspace endpoints: list/get/delete, GC trigger, archive manifest/download. Workspace API is operational, not an execution path. Enforces provider ownership rules, ID validation, active-session exclusion, and conservative cleanup scope tied to provider policy.
Archive & Download Safety
coding-agent/docs/adr/0021-remote-session-and-workspace-operations-api.md (lines 133–157)
Manifest-first download contract: clients fetch manifest before download to declare overwrite intent explicitly. Enumerates required manifest fields. CLI displays manifest and requires user confirmation for overwrite unless non-interactive mode is documented.
Event Model & Authorization
coding-agent/docs/adr/0021-remote-session-and-workspace-operations-api.md (lines 158–208)
Preserves existing SSE wire event names for CLI compatibility while enabling new lifecycle events for UI/CI/editor clients. Bearer token scopes: normal (own session/workspace/archive ops) and admin (global listing, GC, cleanup, recovery). Requires stable owner label and fail-closed production authentication.
CLI Implementation & Consequences
coding-agent/docs/adr/0021-remote-session-and-workspace-operations-api.md (lines 209–241)
CLI becomes thin HTTP client with new coding-agent remote commands for session/workspace control, archive download with manifest confirmation, and remote goal execution. Remote repl is a compatibility alias; new workflows use remote run. Consequences: automatable HTTP operations, explicit server contracts with stable schema, lightweight token scope separation, manifest-first safety, SSE compatibility preserved.
Implementation Plan & Acceptance
coding-agent/docs/adr/0021-remote-session-and-workspace-operations-api.md (lines 242–364)
Multi-PR plan: schemas + auth + session list/status; cancel contract + event hardening; workspace inventory/cleanup/archive manifest; CLI wiring + manifest UX. Acceptance criteria cover session listing visibility, cancel atomicity, workspace admin scope, archive field correctness, and end-to-end remote run. Rejected alternatives: CLI-only UX, CLI-performed cleanup, admin ops in normal token, SSE wire event renaming, live sync/patch export, expanded provider types. References link to related ADRs and implementation files.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A hop through parent and child,
Where subagents run wild and free,
Remote ops now tame and mild,
HTTP sets the API spree!
Manifests guard the download way, ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'docs: add ADR-0021 remote operations API' accurately describes the main addition of ADR-0021 documentation. However, the PR also includes the restoration of missing parent-child subagent evaluation golden fixtures (JSONL and YAML files), which is a secondary but substantive change not reflected in the title.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/adr-0021-remote-operations-api

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (4)
coding-agent/docs/adr/0021-remote-session-and-workspace-operations-api.md (4)

201-204: ⚡ Quick win

Specify stable owner label derivation more precisely.

The guidance to "derive a stable owner label from the authenticated token, such as a hash or configured token label" lacks implementation details. Consider specifying:

  • If using a hash: which algorithm (SHA-256?) and what input (full token? prefix?)
  • Collision handling strategy
  • Or recommend token-to-label mapping via configuration

Vague authorization logic can lead to inconsistent or weak implementations.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@coding-agent/docs/adr/0021-remote-session-and-workspace-operations-api.md`
around lines 201 - 204, Specify deterministic label derivation: compute a
SHA-256 hex of the full authenticated token and prefix it (e.g. "owner:") to
form the stable owner label for P1; on creation, check a persistent
TokenLabelMap (config-backed or DB) to detect collisions and if a collision
occurs, disambiguate by appending a short counter or using an HMAC with a
per-deployment salt stored in configuration; additionally allow an explicit
token-to-label mapping via configuration (TokenLabelMap) to override the
hash-derived label and document that the system must persist and consult this
mapping whenever resolving owner labels.

45-66: ⚡ Quick win

Clarify which endpoints are new vs. existing.

The "canonical P1 session API" list (lines 45-52) and "Existing endpoints remain compatible" list (lines 54-62) have significant overlap (POST /prompt, GET /events, GET /DELETE sessions endpoints appear in both), making it unclear which endpoints P1 is adding versus preserving.

Consider restructuring to explicitly call out:

  • New in P1: GET /sessions, POST /cancel, workspace archive manifest endpoints
  • Existing (preserved): All others

This would help implementers understand the delta more clearly.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@coding-agent/docs/adr/0021-remote-session-and-workspace-operations-api.md`
around lines 45 - 66, The two endpoint lists are ambiguous because several
routes (e.g., POST /sessions/{session_id}/prompt, GET
/sessions/{session_id}/events, GET /sessions/{session_id}, DELETE
/sessions/{session_id}) appear in both; update the document to clearly separate
"New in P1" and "Existing (preserved)" sections: under "New in P1" list only GET
/sessions, POST /sessions/{session_id}/cancel, GET
/sessions/{session_id}/workspace/archive/manifest, and GET
/sessions/{session_id}/workspace/archive; under "Existing (preserved)" list POST
/sessions, POST /sessions/{session_id}/prompt, POST
/sessions/{session_id}/approve, GET /sessions/{session_id}/events, GET
/sessions/{session_id}, DELETE /sessions/{session_id}, and GET
/sessions/{session_id}/workspace (with a note that GET
/sessions/{session_id}/workspace is a compatibility alias for /workspace/archive
and new clients should use /workspace/archive/manifest then /workspace/archive).

150-150: ⚡ Quick win

Clarify "cheap to compute" criteria for SHA-256.

The phrase "when cheap to compute without double-exporting" is subjective. Consider specifying concrete criteria (e.g., "when the archive is already materialized" or "when total_bytes < 100MB") to ensure consistent manifest behavior across implementations.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@coding-agent/docs/adr/0021-remote-session-and-workspace-operations-api.md` at
line 150, Replace the vague clause for the manifest field `archive_sha256`
("when cheap to compute without double-exporting") with concrete, testable
criteria—for example: "include `archive_sha256` when the archive is already
materialized (e.g., stored on disk or in object storage) or when the archive
size is below a defined threshold (e.g., total_bytes < 100MB)." Update the
wording in the ADR section that currently reads "when cheap to compute without
double-exporting" to one or two specific rules (materialized state and/or
byte-size threshold) and add a short note that implementations must document
which rule they follow.

364-364: 💤 Low value

Remove trailing line number artifact.

Line 364 appears to contain only a line number without content, likely a formatting artifact from the annotation process.

🧹 Proposed fix
 - `tests/coding_agent/environment/test_docker_workspace_provider.py`
-365
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@coding-agent/docs/adr/0021-remote-session-and-workspace-operations-api.md` at
line 364, Remove the stray trailing artifact line that contains the lone string
"tests/coding_agent/environment/test_docker_workspace_provider.py" from the ADR
document (0021-remote-session-and-workspace-operations-api.md); locate the
isolated line 364 with that content and delete it so the file no longer includes
the extraneous line number/artifact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@coding-agent/docs/adr/0021-remote-session-and-workspace-operations-api.md`:
- Around line 201-204: Specify deterministic label derivation: compute a SHA-256
hex of the full authenticated token and prefix it (e.g. "owner:") to form the
stable owner label for P1; on creation, check a persistent TokenLabelMap
(config-backed or DB) to detect collisions and if a collision occurs,
disambiguate by appending a short counter or using an HMAC with a per-deployment
salt stored in configuration; additionally allow an explicit token-to-label
mapping via configuration (TokenLabelMap) to override the hash-derived label and
document that the system must persist and consult this mapping whenever
resolving owner labels.
- Around line 45-66: The two endpoint lists are ambiguous because several routes
(e.g., POST /sessions/{session_id}/prompt, GET /sessions/{session_id}/events,
GET /sessions/{session_id}, DELETE /sessions/{session_id}) appear in both;
update the document to clearly separate "New in P1" and "Existing (preserved)"
sections: under "New in P1" list only GET /sessions, POST
/sessions/{session_id}/cancel, GET
/sessions/{session_id}/workspace/archive/manifest, and GET
/sessions/{session_id}/workspace/archive; under "Existing (preserved)" list POST
/sessions, POST /sessions/{session_id}/prompt, POST
/sessions/{session_id}/approve, GET /sessions/{session_id}/events, GET
/sessions/{session_id}, DELETE /sessions/{session_id}, and GET
/sessions/{session_id}/workspace (with a note that GET
/sessions/{session_id}/workspace is a compatibility alias for /workspace/archive
and new clients should use /workspace/archive/manifest then /workspace/archive).
- Line 150: Replace the vague clause for the manifest field `archive_sha256`
("when cheap to compute without double-exporting") with concrete, testable
criteria—for example: "include `archive_sha256` when the archive is already
materialized (e.g., stored on disk or in object storage) or when the archive
size is below a defined threshold (e.g., total_bytes < 100MB)." Update the
wording in the ADR section that currently reads "when cheap to compute without
double-exporting" to one or two specific rules (materialized state and/or
byte-size threshold) and add a short note that implementations must document
which rule they follow.
- Line 364: Remove the stray trailing artifact line that contains the lone
string "tests/coding_agent/environment/test_docker_workspace_provider.py" from
the ADR document (0021-remote-session-and-workspace-operations-api.md); locate
the isolated line 364 with that content and delete it so the file no longer
includes the extraneous line number/artifact.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f9607849-ae77-4a07-bf5f-53002c32c32b

📥 Commits

Reviewing files that changed from the base of the PR and between 988bd4e and 9c895a3.

📒 Files selected for processing (3)
  • coding-agent/data/eval/golden/parent-child-subagent-001.jsonl
  • coding-agent/data/eval/golden/parent-child-subagent-001.yaml
  • coding-agent/docs/adr/0021-remote-session-and-workspace-operations-api.md

Clarify new versus preserved session endpoints, make archive checksum rules testable, define deterministic token owner labels, and remove the extra trailing reference.
@delete-cloud
delete-cloud merged commit 781d7bb into main May 10, 2026
1 check passed
@delete-cloud
delete-cloud deleted the feat/adr-0021-remote-operations-api branch May 10, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant